<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1" xml:lang="en">
  <title id="gq143896">pg_index</title>
  <body>
    <p>The <codeph>pg_index</codeph> system catalog table contains part of the information about
      indexes. The rest is mostly in <xref href="pg_class.xml#topic1">pg_class</xref>.</p>
    <table id="gq143898">
      <title>pg_catalog.pg_index</title>
      <tgroup cols="4">
        <colspec colnum="1" colname="col1" colwidth="131pt"/>
        <colspec colnum="2" colname="col2" colwidth="70.5pt"/>
        <colspec colnum="3" colname="col3" colwidth="108pt"/>
        <colspec colnum="4" colname="col4" colwidth="147pt"/>
        <thead>
          <row>
            <entry colname="col1">column</entry>
            <entry colname="col2">type</entry>
            <entry colname="col3">references</entry>
            <entry colname="col4">description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry colname="col1">
              <codeph>indexrelid</codeph>
            </entry>
            <entry colname="col2">oid</entry>
            <entry colname="col3">pg_class.oid</entry>
            <entry colname="col4">The OID of the pg_class entry for this index.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indrelid</codeph>
            </entry>
            <entry colname="col2">oid</entry>
            <entry colname="col3">pg_class.oid</entry>
            <entry colname="col4">The OID of the pg_class entry for the table this index is
              for.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indnatts</codeph>
            </entry>
            <entry colname="col2">int2</entry>
            <entry colname="col3"/>
            <entry colname="col4">The number of columns in the index (duplicates
              pg_class.relnatts).</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indisunique</codeph>
            </entry>
            <entry colname="col2">boolean </entry>
            <entry colname="col3"/>
            <entry colname="col4">If true, this is a unique index.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indisprimary</codeph>
            </entry>
            <entry colname="col2">boolean</entry>
            <entry colname="col3"/>
            <entry colname="col4">If true, this index represents the primary key of the table.
              (indisunique should always be true when this is true.)</entry>
          </row>
          <row>
            <entry><codeph>indisexclusion</codeph></entry>
            <entry>boolean</entry>
            <entry/>
            <entry>If true, this index supports an exclusion constraint</entry>
          </row>
          <row>
            <entry>indimmediate</entry>
            <entry>boolean</entry>
            <entry/>
            <entry>If true, the uniqueness check is enforced immediately on insertion (irrelevant if
                <codeph>indisunique</codeph> is not true)</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indisclustered</codeph>
            </entry>
            <entry colname="col2">boolean</entry>
            <entry colname="col3"/>
            <entry colname="col4">If true, the table was last clustered on this index via the
                <codeph>CLUSTER</codeph> command.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indisvalid</codeph>
            </entry>
            <entry colname="col2">boolean</entry>
            <entry colname="col3"/>
            <entry colname="col4">If true, the index is currently valid for queries. False means the
              index is possibly incomplete: it must still be modified by
                <codeph>INSERT</codeph>/<codeph>UPDATE</codeph> operations, but it cannot safely be
              used for queries.</entry>
          </row>
          <row>
            <entry><codeph>indcheckxmin</codeph></entry>
            <entry>boolean</entry>
            <entry/>
            <entry>If true, queries must not use the index until the <codeph>xmin</codeph> of this
                <codeph>pg_index</codeph> row is below their <codeph>TransactionXmin</codeph> event
              horizon, because the table may contain broken HOT chains with incompatible rows that
              they can see</entry>
          </row>
          <row>
            <entry><codeph>indisready</codeph></entry>
            <entry>boolean</entry>
            <entry/>
            <entry>If true, the index is currently ready for inserts. False means the index must be
              ignored by <codeph>INSERT</codeph>/<codeph>UPDATE</codeph> operations</entry>
          </row>
          <row>
            <entry><codeph>indislive</codeph></entry>
            <entry>boolean</entry>
            <entry/>
            <entry>If false, the index is in process of being dropped, and should be ignored for all
              purposes </entry>
          </row>
          <row>
            <entry><codeph>indisreplident</codeph></entry>
            <entry>boolean</entry>
            <entry/>
            <entry>If true this index has been chosen as "replica identity" using <codeph>ALTER
                TABLE ... REPLICA IDENTITY USING INDEX ...</codeph></entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indkey</codeph>
            </entry>
            <entry colname="col2">int2vector</entry>
            <entry colname="col3">pg_attribute.attnum</entry>
            <entry colname="col4">This is an array of <codeph>indnatts</codeph> values that indicate
              which table columns this index indexes. For example a value of 1 3 would mean that the
              first and the third table columns make up the index key. A zero in this array
              indicates that the corresponding index attribute is an expression over the table
              columns, rather than a simple column reference.</entry>
          </row>
          <row>
            <entry><codeph>indcollation</codeph></entry>
            <entry>oidvector</entry>
            <entry/>
            <entry>For each column in the index key, this contains the OID of the collation to use
              for the index.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indclass</codeph>
            </entry>
            <entry colname="col2">oidvector</entry>
            <entry colname="col3">pg_opclass.oid</entry>
            <entry colname="col4">For each column in the index key this contains the OID of the
              operator class to use.</entry>
          </row>
          <row>
            <entry><codeph>indoption</codeph></entry>
            <entry>int2vector</entry>
            <entry/>
            <entry>This is an array of <codeph>indnatts</codeph> values that store per-column flag
              bits. The meaning of the bits is defined by the index's access method.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indexprs</codeph>
            </entry>
            <entry colname="col2">text</entry>
            <entry colname="col3"/>
            <entry colname="col4">Expression trees (in <codeph>nodeToString()</codeph>
              representation) for index attributes that are not simple column references. This is a
              list with one element for each zero entry in indkey. NULL if all index attributes are
              simple references.</entry>
          </row>
          <row>
            <entry colname="col1">
              <codeph>indpred</codeph>
            </entry>
            <entry colname="col2">text</entry>
            <entry colname="col3"/>
            <entry colname="col4">Expression tree (in <codeph>nodeToString()</codeph>
              representation) for partial index predicate. NULL if not a partial index.</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
  </body>
</topic>
